The following are new sound informational selectors added since the release of Sound Manager 3.0. These selectors are used to obtain information and control the sound environment using the GetSoundOutputInfo, SetSoundOutputInfo, SndGetInfo, SndSetInfo, or SPBGetDeviceInfo, and SPBSetDeviceInfo routines.
This selector is used by all input and output devices, and returns the state of the hardware--typically, whether or not hardware interrupts are active. For input devices, the infoData parameter points to a short word. For output devices, the infoPtr is a short word containing the value.
A value of 0 represents that the hardware is not busy, while a value of 1 represents busy. This selector is only supported by the get calls, since it does not make sense to "set" a device busy.
short hwBusy;
err = GetSoundOutputInfo(nil, siHardwareBusy, &hwBusy);
The siHardwareFormat selector has been added for output devices. Use this selector with the GetSoundOutputInfo and SndGetInfo routines. It returns a SoundComponentData structure of the format used by the output hardware device.
SoundComponentData outputFormat;
err = GetSoundOutputInfo(nil, siHardwareFormat, &outputFormat);
This output selector was previously defined, but should be documented and implemented as returning the mute state of all sources that can be heard. For example, Power Macintosh computers have a speaker and headphone source. If no headphones are plugged in, then return the mute state of the speakers. If headphones are inserted, then return the mute state of both (e.g. siHardwareMute is muted when both speakers and headphones are muted). The idea is if the user has sources that can be heard and all are muted, then the hardware has been muted. If any one of the sources can be heard, then the hardware is not muted.
short hwMuted;
err = GetSoundOutputInfo(nil, siHardwareMute, &hwMuted);
This output selector was previously defined, but should be documented and implemented as returning the volume of the device that can be heard. For example, Power Macintosh computers can have the speaker and the headphones both be audible to the user.
In this case, return the loudest volume setting. If both the speaker and the headphones are muted, then again return the loudest setting. If one is muted and the other is audible, then return the volume of the audible source.
unsigned long hwVolume;
err = GetSoundOutputInfo(nil, siHardwareVolume, &hwVolume);
This selector is used to install a given sound component into the component chain. The given component will be installed just before the mixer component. This sound component can access the audio stream and modify the data prior to its being sent to the mixer. An example of its use is shown as follows by installing the Sound Sprockets sound localizer.
SoundComponentLink soundLink;
soundLink.description.componentType = kSoundEffectsType;
soundLink.description.componentSubType = kSSpLocalizationSubType;
soundLink.description.componentManufacturer = kAnyComponentManufacturer;
soundLink.description.componentFlags = 0;
soundLink.description.componentFlagsMask = kAnyComponentFlagsMask;
soundLink.mixerID = nil;
soundLink.linkID = nil;
err = SndSetInfo(chan, siPreMixerSoundComponent, &soundLink);
// configure the localization settings
// and send them to the sound component
err = SndSetInfo(chan, siSSpLocalization, &localizationSettings);
This selector is only used by input devices that have special requirements in order to hear the audio from the CD player. For example, currently the 840AV and Power Macintosh computers require the user to open the Sound control panel, select the Inputs panel, and then open the Options dialog. From here they have to select the CD Input and also check the Play-Through option. The new siSetupCDAudio avoids this troublesome operation by setting up the input device to allow you to hear audio CDs from the audio CD player.
The infoData parameter points to a short word. A value of 1 means to set up the hardware (for example, set input source to CD and turn on Play-Through). A value of 0 means to return the input hardware to some initial state, either the default settings or the settings prior to setting up for the CD audio. Any other value is an error.
If the input device had no special needs for CD audio (for exmaple, the audio is heard regardless of the input hardware settings), then the selector is not supported and it returns an error. The SPBGetDeviceInfo routine should return a 1 or 0 value, depending on its current setting. If the input source is the CD and Play-Through, if required, is on, then return the value of 1. This should happen even if nothing ever requested setting up for CD audio. It should return the state of the actual condition of the input hardware.
| Previous | Chapter Contents | Chapter Top | Next |